//
//  UIBarButtonItem+Extension.swift
//  weibo
//
//  Created by Ning Xie on 16/8/10.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
    convenience init(title:String,target:AnyObject?,action:Selector) {
        self.init()
        
        let button = UIButton()
        
        button.setTitle(title, forState: .Normal)
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        button.titleLabel?.font = UIFont.systemFontOfSize(15)
        button.sizeToFit()
        
        button.addTarget(target, action: action, forControlEvents: .TouchDown)
        
        customView = button
        
        
        
    }
    
    
}
